package com.tensquare.friend.dao;

import com.tensquare.friend.model.Friend;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface FriendDao extends JpaRepository<Friend,String> {

    Friend findFirstByUseridAndFriendid(String userId , String friendId);

    @Modifying
    @Query(nativeQuery = true,
    value = "UPDATE tb_friend SET islike = ? WHERE userid = ? AND friendid = ? ")
    void updateIsLike(String isLike , String userId , String friendId);

    @Modifying
    @Query(nativeQuery = true,
    value = "delete from tb_friend  WHERE userid = ? AND friendid = ?   ")
    void deleteFriend(String userId, String friendId);

}
